using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Goods - 商品 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleGoods<T> :ModelBase<ArticleGoods> where T : ArticleGoods, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.GoodsId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return GoodsId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.GoodsId=dy.GoodsId;
           this.ContentId=dy.ContentId;
           this.GoodsName=dy.GoodsName;
           this.Price=dy.Price;
           this.Standard=dy.Standard;
           this.GoodsModel=dy.GoodsModel;
           this.TxtId=dy.TxtId;
        } 

        #region 定义属性

     
         /// <summary>
        /// 商品ID
        /// </summary>
        private String _GoodsId = "";
      
        /// <summary>
        /// 商品ID
        /// </summary>
        public String GoodsId
        {
            get 
            {
              return   (this._GoodsId); 
            }

            set 
            {
                    _GoodsId= value;  
            }
        }
       
     
         /// <summary>
        /// 内容ID
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// 内容ID
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 商品名称
        /// </summary>
        private String _GoodsName = "";
      
        /// <summary>
        /// 商品名称
        /// </summary>
        public String GoodsName
        {
            get 
            {
              return   (this._GoodsName); 
            }

            set 
            {
                    _GoodsName= value;  
            }
        }
       
     
         /// <summary>
        /// 价格
        /// </summary>
        private Decimal _Price = decimal.MinValue;
      
        /// <summary>
        /// 价格
        /// </summary>
        public Decimal Price
        {
            get 
            {
              return   (this._Price); 
            }

            set 
            {
                    _Price= value;  
            }
        }
       
     
         /// <summary>
        /// 规格
        /// </summary>
        private String _Standard = "";
      
        /// <summary>
        /// 规格
        /// </summary>
        public String Standard
        {
            get 
            {
              return   (this._Standard); 
            }

            set 
            {
                    _Standard= value;  
            }
        }
       
     
         /// <summary>
        /// 型号
        /// </summary>
        private String _GoodsModel = "";
      
        /// <summary>
        /// 型号
        /// </summary>
        public String GoodsModel
        {
            get 
            {
              return   (this._GoodsModel); 
            }

            set 
            {
                    _GoodsModel= value;  
            }
        }
       
     
         /// <summary>
        /// 商品介绍
        /// </summary>
        private String _TxtId = "";
      
        /// <summary>
        /// 商品介绍
        /// </summary>
        public String TxtId
        {
            get 
            {
              return   (this._TxtId); 
            }

            set 
            {
                    _TxtId= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleGoods info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["GoodsId"]!= DBNull.Value)
                  {
                  info.GoodsId=row["GoodsId"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["GoodsName"]!= DBNull.Value)
                  {
                  info.GoodsName=row["GoodsName"].ToString();
                 }
                 
                  
                  if(row["Price"]!= DBNull.Value)
                  {
                  info.Price=Convert.ToDecimal(row["Price"]);
                 }
                 
                  
                  if(row["Standard"]!= DBNull.Value)
                  {
                  info.Standard=row["Standard"].ToString();
                 }
                 
                  
                  if(row["GoodsModel"]!= DBNull.Value)
                  {
                  info.GoodsModel=row["GoodsModel"].ToString();
                 }
                 
                  
                  if(row["TxtId"]!= DBNull.Value)
                  {
                  info.TxtId=row["TxtId"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleGoods info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@GoodsId", DbType.String,ParameterTool.GetObj( info._GoodsId )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@GoodsName", DbType.String,ParameterTool.GetObj( info._GoodsName )); 
            
             
                cn.AddInParameter(comm, "@Price", DbType.Decimal,ParameterTool.GetObj( info._Price )); 
            
             
                cn.AddInParameter(comm, "@Standard", DbType.String,ParameterTool.GetObj( info._Standard )); 
            
             
                cn.AddInParameter(comm, "@GoodsModel", DbType.String,ParameterTool.GetObj( info._GoodsModel )); 
            
             
                cn.AddInParameter(comm, "@TxtId", DbType.String,ParameterTool.GetObj( info._TxtId )); 
            
        } 

    } 
} 